<style lang="less">
@import '../../../styles/common.less';
</style>
<template>
  <Card>
    <Row>
      <Button type="text" style="margin-left: 92%;font-family:'PingFang SC';font-weight:bold;color:#57a3f3;" @click="openModal">查看征信信息</Button>
      <Modal v-model="modal1" :scrollable="true" width=1000 :styles="{top: '20px'}" @on-cancel="closeModal">
        <task-detail-component :comptParams="modalComptParams"></task-detail-component>
      </Modal>
      <Tabs v-model="curTab" @on-click="clickTab">
        <TabPane label="催收基本信息" name="collectBaseInfo">
          <collect-base-info :collectTaskParams='collectTaskParams'></collect-base-info>
        </TabPane>
        <TabPane label="融资账户" name="financeAccount">
          <finance-account :collectTaskParams='collectTaskParams'></finance-account>
        </TabPane>
      </Tabs>
    </Row>
  </Card>
</template>

<script>
import taskDetailComponent from '../../approval-management/task-processing/task-detail-component.vue'
import collectBaseInfo from './collect-base-info.vue'
import financeAccount from './finance-account.vue'
export default {
  name: 'collection-deal-compent',
  components: {
    collectBaseInfo,
    financeAccount,
    taskDetailComponent
  },
  data () {
    return {
      modal1: false,
      modalComptParams: {// 传递给taskDetailComponent的参数对象
        isModal: true,
        curLoanId: ''
      },
      curTab: null,
      collectTaskParams: {// 传递给子tab的参数对象
        loanId: '',
        overdueType: '',
        overdueCode: '',
        overdueCaseId: '',
        collectBaseInfo: false,
        financeAccount: false
      }
    }
  },
  computed: {
    avatorImage () {
      return localStorage.avatorImgPath
    }
  },

  created () {
    // 初始化当前页面请求对象实例
    this.collectTaskParams.loanId = this.$route.query.loanId
    this.collectTaskParams.overdueCode = this.$route.query.overdueCode
    this.collectTaskParams.custCardNo = this.$route.query.custCardNo
    this.collectTaskParams.overdueCaseId = this.$route.query.overdueCaseId
    this.collectTaskParams.overdueType = this.$route.query.overdueType
    this.initpage()
  },
  methods: {
    openModal: function () {
      var vm = this
      this.modal1 = true
      this.modalComptParams.isModal = false
      setTimeout(function () {
        vm.modalComptParams.isModal = true
        vm.modalComptParams.curLoanId = vm.collectTaskParams.loanId
      }, 200)
    },
    closeModal () {
      this.modal1 = false
      this.modalComptParams.isModal = false
    },
    // 点击tab事件
    clickTab (tabName) {
      this.collectTaskParams[tabName] = true
    },
    initpage: function () {
      var vm = this
      // 加载默认tab页签数据
      vm.collectTaskParams[this.curTab] = true
    }
  }
}
</script>
